package asteroids.model.programs.expression;

import java.util.ArrayList;

import asteroids.model.programs.*;
import asteroids.model.programs.type.Bool;

public class Conjunction extends Logic {

	private E left;
	
	public Conjunction(int line, int column, E left, E right) {
		super(line, column, right);
		this.left = left;
	}

	@Override
	public Bool getValue() {
		return new Bool(((Bool)getLeft().getValue()).getValue() || ((Bool)getRight().getValue()).getValue());
	}
	
	public E getLeft(){
		return left;
	}
	
	@Override
	public ArrayList<VariableExpression> getVariables(){
		ArrayList<VariableExpression> list = left.getVariables();
		list.addAll(right.getVariables());
		return list;
	}
}
